//   引入路由 API
// import Profile from "@/views/profile.vue";
import {createRouter, createWebHashHistory } from "vue-router";
import Layout from '@/layout/Index.vue'

//   引入页面
// const Home = () => import('../views/Home.vue')
// const About = () => import('../views/About.vue')
// const Vuexpage = () =>import("../views/Vuex.vue")
// const Login  = () =>import("../views/Login.vue")
// const Center  = () =>import("../views/user-center/Login.vue")
// const Profile  = () =>import("../views/Profile.vue")
// const Settings  = () =>import("../views/Settings.vue")
const Login = ()=>import("@/views/login/Index.vue")
const PersonalIndex= ()=>import("@/views/Personal/Index.vue")
const PersonalMessage = ()=>import("@/views/Personal/Message.vue")
const AppIndex = ()=>import("@/views/app/Index.vue")

const NotFound = ()=>import("@/views/404.vue")




//   注册路径及页面
// const routeConfig = [
// {path: '/', redirect: '/home'},
// {path: '/home',name:'home', component: Home},
// {path: '/about',name: component, About},
// {path: '/vuex',
//  name:'vuex',
//  component:Vuexpage  },

// // admin
// {path: '/login'},
// {path: 'login',  component:Login},

const routers = [
    {
        path:'/',
        name:'Home',
        component:Layout,
        children: [
            //登录页
            {
                path:'login',
                name:'login',
                component: Login
            },
            //个人中心页
            {
                path:'Personal',
                name:'Personal',
                component: PersonalIndex,
                children: [
                    {
                        path: 'Message',
                        name:'PersonalMessage ',
                        component: PersonalMessage
                    },
                ]
            },
            //App内部页
            {
                path: 'app',
                name: 'App',
                component: AppIndex
            },
            //404
            {
                path:'404',
                name:'NotFound',
                component: NotFound
            }
        ],
    },
    {
        path
    }
]

// {
//     path:'/user',
//     componment:Center,
//     redirect:'/user/profile',
//     children:[
//         {
//             path:'profile',
//             componment:Profile
//         },
//         {
//             path:'settings',
//             component:Settings
//         }
//     ]


创建Router实例并配置
const router = createRouter({
    // 4.内部提供了 history 模式的实现。 为了简单起见， 我们在这里使用 hash 模式。
    history:createWebHashHistory(),
    routes:routeConfig
    // router, 'routes: routes'的缩写
})

// 输出 vue-router实例对象
export default router


